package com.example.peanutsubway.web;

import com.example.peanutsubway.annotation.ResponseTypeAnnotation;
import com.example.peanutsubway.entity.AdminUserinfo;
import com.example.peanutsubway.service.AdminUserService;
import com.example.peanutsubway.service.impl.AdminUserServiceImpl;

import javax.servlet.annotation.WebServlet;

/**
 * @Author：zzt
 * @Version：1.0
 * @Date：2021/10/17-18:26
 * @Since:jdk1.8
 * @Description:
 */
@WebServlet("/adminUser.do")
public class AdminUserServlet extends BaseServlet<AdminUserinfo> {
    private AdminUserService adminUserService = new AdminUserServiceImpl();
    @ResponseTypeAnnotation
    public String updateUser(AdminUserinfo adminUserinfo){
        return adminUserService.updateUser(adminUserinfo).toString();
    }

    @ResponseTypeAnnotation
    public String deleteUser(Integer id){
        String userId = request.getParameter("userId");
        return adminUserService.deleteUser(Integer.parseInt(userId)).toString();
    }

    @ResponseTypeAnnotation
    public String addUser(AdminUserinfo adminUserinfo){
        return adminUserService.addUser(adminUserinfo).toString();
    }
}
